<!DOCTYPE html>
<html>
<#include "../head.html">
<body class="full">
<div class="mc">
    <div class="mc-l">
        <!--左侧导航---{-->
        <div id="navPanelContainer">
            <div class="system-logo cd"></div>
            <!--管理员信息---{-->
            <#include "../adminInfo.html">
                <!--管理员信息---}-->
                <div class="nav-wrap">
                    <#include "left.html">
                </div>
        </div>
        <!--左侧导航---}-->
    </div>
    <div class="mc-m">
        <div class="navToggle"></div>
    </div>
    <div class="mc-r">
        <!--顶部导航---{-->
        <#include "../topNav.html">
            <!--顶部导航---}-->

            <!--面包屑导航---{-->
            <#assign moduleName="所有借款标">
                <#include "banner.html">
                    <!--面包屑导航---}-->

                    <!--工具栏--{-->
                    <div id="toolbar" class="clearfix">
                        <#if param??&&param.status??>
                            <#assign status=(param.get("status"))?number >
                                <#else>
                                    <#assign status=-1>
                        </#if>
                        <div class="toolbor-module export">
                            <input type="button" onclick="exportxls()" value="导出列表" class="input-button export-btn"/>
                        </div>
                        <div class="toolbor-module export">
                            <div class="formTit">
                                &nbsp;&nbsp;&nbsp;项目总额：${(num?c)!0} </div>
                        </div>
                        <div class="toolbor-module search">
                            <input type="button" value="搜索"  class="input-button" onclick="sousuo();">
                        </div>

                        <div class="toolbor-module search">
                            <div class="formTit">状态：</div>

                            <div class="select-box" id="status">
                                <div class="tag-select">全部</div>
                                <ul class="tag-options">
                                    <li data-value="" >全部</li>
                                    <li data-value="6" >还款中</li>
                                    <li data-value="7" >部分还款</li>
                                    <li data-value="8" >还款成功</li>
                                </ul>
                            </div>
                        </div>

                        <div class="toolbor-module search">
                            <div class="formTit">资产管理公司：</div>
                            <div class="select-box" id="fid">
                                <div class="tag-select">全部</div>
                                <ul class="tag-options">
                                    <li data-value="" >全部</li>
                                    <#if fList??>
                                        <#list fList as item>
                                            <li data-value="${item.id?c}" >${item.name}</li>
                                        </#list>
                                    </#if>
                                </ul>
                            </div>
                        </div>

                        <div class="toolbor-module search">
                            <div class="formTit">用户名：</div>
                            <input type="text" name="username" id="username" value="请输入用户名"  class="search-value">
                        </div>

                        <div class="toolbor-module search">
                            <div class="formTit">项目名：</div>
                            <input type="text" name="name" id="name" value="请输入项目名"  class="search-value">
                        </div>

                        <!-- <div class="toolbor-module search">
                            <input type="button" value="今日待还项目"  class="input-button" onclick="timeLimitSearch(0);">
                        </div>

                        <div class="toolbor-module search">
                            <input type="button" value="最近3天待还项目"  class="input-button" onclick="timeLimitSearch(3);">
                        </div> -->
                    </div>
                    <!--工具栏--}-->

                    <div id="main" class="clearfix">
                        <form action="" method="post">
                            <table class="data-list">
                                <tr class="header">
                                    <td>ID</td>
                                    <td>资产管理公司</td>
                                    <td>项目名</td>
                                    <td>项目金额</td>
                                    <td>年利率</td>
                                    <td>借款期限</td>
                                    <td>发布时间</td>
                                    <td>还款人</td>
                                    <td>真实姓名</td>
                                    <!-- <td>预期还款时间</td> -->
                                    <td>资产公司还款本息</td>
                                    <td>实际本息</td>
                                    <td>加息利息</td>
                                    <td>满标时间</td>
                                    <td>上标时间</td>
                                    <td>应还款时间</td>
                                    <td>联系方式</td>
                                    <td>状态</td>
                                    <td>操作</td>
                                    <td>操作2</td>
                                </tr>
                                <#import "../../common/function.html" as func>
                                    <#list list as item>
                                        <!-- 排除流转标和还款完成的借款 -->
                                        <#if item.type!=110 && item.status!=8>
                                            <#assign repayTime=getRepayDatetime(item)>
                                                <#assign today=dateroll(dateformat("now")?c,0,0,0,"yyyy-MM-dd HH:mm:ss")>
                                                    <#assign prevDay=dateroll(dateformat("now")?c,0,0,3,"yyyy-MM-dd HH:mm:ss")>
                                                        <#if dateformat(today) gte dateformat(repayTime)>
                                                            <#assign tstyle="color:red;">
                                                                <#elseif dateformat(prevDay) gte dateformat(repayTime)>
                                                                    <#assign tstyle="color:orange;">
                                                                        <#else>
                                                                            <#assign tstyle="">
                                                        </#if>
                                                        <#else>
                                                            <#assign tstyle="">
                                        </#if>
                                        <tr class="s" style="${tstyle!}">
                                            <td>${(item.id!)?c}</td>
                                            <td>${item.franchisee.name!}</td>
                                            <td title="${item.name}" class="tal"><@func.borrowTypeName item=item />_${item.name!}</td>
                                            <td>${item.account!0}元</td>
                                            <#if item.extraAwardApr gt 0>
                                                <td>${item.apr!}%+${item.extraAwardApr!}%</td>
                                                <#else>
                                                    <td>${item.apr!}%</td>
                                            </#if>
                                            <td><#if item.isday==1>${item.timeLimitDay!"-"}天<#else>${item.timeLimit!"-"}个月</#if></td>
                                            <td>${(item.addtime)?string("yyyy-MM-dd")}</td>
                                            <td>${item.user.showName!}</td>
                                            <td>${item.user.realName!}</td>
                                            <!-- <td>${getRepaytime(item)}</td> -->
                                            <td><#list item.borrowRepayments as item>${item.repaymentAccount!}</#list></td>
                                            <td><#list item.borrowRepayments as item>${item.tenderRepaymentAccount!}</#list></td>
                                            <td>
                                                <#assign extraAwardInterest=0>
                                                    <#list item.borrowTenders as item>
                                                        <#assign extraAwardInterest=extraAwardInterest+item.extraAwardInterest>
                                                    </#list>
                                                    ${extraAwardInterest!}
                                            </td>
                                            <td><#list item.borrowRepayments as item>${item.addtime!}</#list></td>
                                            <td>${item.secVerifyTime!}</td>
                                            <td><#list item.borrowRepayments as item>
                                                ${item.repaymentTime?string("yyyy-MM-dd")}
                                            </#list></td>
                                            <td>${item.user.phone!"-"}</td>
                                            <td><@func.statusTypeName status=item.status type=item.type /></td>
                                            <td>
                                                <dd><a class="un" href="${request.getContextPath()}/admin/borrow/viewRepayingBorrow.html?id=${item.id?c}" >查看</a></dd>
                                            </td>
                                            <td>
                                                <#if item.status==1>
                                                    <#if item.goTop==1>
                                                        <a class="un" href="javascript:void(0);" onclick="chacelTop(${item.id?c})">取消置顶</a>
                                                        <#else>
                                                            <a class="un" href="javascript:void(0);" onclick="clickTop(${item.id?c})">置顶</a>
                                                    </#if>
                                                </#if>
                                            </td>
                                        </tr>
                                    </#list>
                            </table>
                            <input type="hidden" id="timeLimit" name="timeLimit" value="" />
                        </form>

                        <!--底部工具栏--{-->
                        <div id="bottomToolbar" class="clearfix">
                            <div class="other-tool">
                                <dl class="refresh-data">
                                    <dt class="refresh-data-icon"></dt>
                                    <dd><a href="javascript:void(0);" class="refresh-page">刷新数据</a></dd>
                                </dl>
                            </div>

                            <!--翻页系统--{-->
                            <div class="container s_formPage">
                                <#import "../../common/page.html" as pager>
                                    <@pager.pagination page=page url="${pageUrl}" map=param style="style1" />
                            </div>
                            <!--翻页系统--}-->
                        </div>
                        <!--底部工具栏--}-->

                        <script>
                            var urls = '?search=true';
                            var xurl = "?type=export"
                            function sousuo(){
                                var sou = "";
                                var username = $("#username").val();
                                if (username!=null&&username!=""&&username!="undefine"&&username!="请输入用户名"){
                                    sou += "&username="+username;
                                }
                                var name = $("#name").val();
                                if (name!=null&&name!=""&&name!="undefine"&&name!="请输入项目名"){
                                    sou += "&name="+name;
                                }
                                var fid = $("#fid").find(".open-selected").attr("data-value");
                                if (fid!=null&&fid!=""&&fid!="undefine"){
                                    sou += "&fid="+fid;
                                }
                                var status = $("#status").find(".open-selected").attr("data-value");
                                if (status!=null&&status!=""&&status!="undefine"){
                                    sou += "&status="+status;
                                }
                                var timeLimit = $("#timeLimit").val();
                                if(timeLimit!=null&&timeLimit!=""&&timeLimit!="undefine"){
                                    sou += "&timeLimit="+timeLimit;
                                }
                                var url=urls+sou
                                location.href=url;
                            }

                            function exportxls(){
                                var sou = "";
                                var username = $("#username").val();
                                if (username!=null&&username!=""&&username!="undefine"&&username!="请输入用户名"){
                                    sou += "&username="+username;
                                }
                                var name = $("#name").val();
                                if (name!=null&&name!=""&&name!="undefine"&&name!="请输入项目名"){
                                    sou += "&name="+name;
                                }
                                var fid = $("#fid").find(".open-selected").attr("data-value");
                                if (fid!=null&&fid!=""&&fid!="undefine"){
                                    sou += "&fid="+fid;
                                }
                                var status = $("#status").find(".open-selected").attr("data-value");
                                if (status!=null&&status!=""&&status!="undefine"){
                                    sou += "&status="+status;
                                }
                                var timeLimit = $("#timeLimit").val();
                                if(timeLimit!=null&&timeLimit!=""&&timeLimit!="undefine"){
                                    sou += "&timeLimit="+timeLimit;
                                }
                                var url=xurl+sou
                                location.href=url;
                            }

                            function timeLimitSearch(timeLimit) {
                                $("#timeLimit").val(timeLimit);
                                sousuo();
                            }
                        </script>
                    </div>
    </div>
</div>
<div class="mc-b"><#include "../foot.html"></div>
<#include "../jsPage.html">
    <script type="text/javascript">
        function clickTop(bid){
            $.ajax({
                type: 'POST',
                url: '/admin/borrow/gotop.html',
                data: {
                    id:bid,
                },
                dataType: 'json',
                async: false,
                success: function (data) {
                    if(data.resultCode){
                        alert(data.resultMsg);
                        location.reload();
                    }else{
                        alert(data.resultMsg);
                    }


                }
            });

        }

        function chacelTop(bid){
            $.ajax({
                type: 'POST',
                url: '/admin/borrow/gotop.html',
                data: {
                    id:bid,
                    chancel:"chancel"
                },
                dataType: 'json',
                async: false,
                success: function (data) {
                    if(data.resultCode){
                        alert(data.resultMsg);
                        location.reload();
                    }else{
                        alert(data.resultMsg);
                    }
                }
            });

        }


    </script>
</body>
</html>
